package task.manager;

import java.io.Serializable;

import android.text.format.Time;

/**
 * The task class for the task manager.
 * 
 * @author Harrison Saylor, Aaron Mead, Marc Huet, Greg Ruskin
 * @version 1.0
 */
public class Task implements Serializable {
	
	// Name and description variables of a task.
	private String title;
//	private String description;
	private int month;
	private int day;
	private int year;
	private int hour;
	private int minute;
	
//	private Location loc;
	
	private boolean isCompleted;
	
	private static final long serialVersionUID = 1;
	
	/**
	 * Task constructor.
	 * 
	 * @param title Name of the task.
	 * @param minute 
	 * @param hour 
	 * @param year 
	 * @param day 
	 * @param month 
	 */
	public Task(String title, int month, int day, int year, Integer hour, Integer minute){
		this.title=title;
		this.month = month;
		this.day = day;
		this.year = year;
		this.hour = hour.intValue();
		this.minute = minute.intValue();
	} // End of constructor.

	public String getTitle() {
		
		return title;
	}

	public boolean getIsCompleted() {
		
		return isCompleted;
	}

	public void setIsCompleted(boolean state){
		isCompleted = state;
		
	}

	public CharSequence getTimeString() {
		if(minute < 10){
			return "" + hour + ":0" + minute;
		}
		else{
			return "" + hour + ":" + minute;
		}
	}

	public CharSequence getDateString() {
		
		return "" + month + "-" + day + "-" + year;
	}

	public boolean isAfter(int month2, int day2, int year2) {
		if(!(year>year2)){
			if(!((year == year2)&&(month>month2))){
				if(!((year == year2)&&(month == month2)&&(day>day2))){
					if(!((year == year2)&&(month == month2)&&(day==day2)))
					return false;
				}
			}
		}
		return true;
	}

	
} // End of Task class.
